import java.util.Scanner;

public class TestDemo {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if(i == j) {
                        System.out.print("*");
                    } else if (j == n-i-1) {
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }
                System.out.printf("\n");
            }
        }
    }

    public static void main(String[] args) {
//水仙花数 使用pow函数
        int n = 100;
        while (n<=999) {
            int i = n % 10;
            int j = n / 10 %10;
            int k = n / 100;
            if (n==(Math.pow(i,3)+Math.pow(j,3)+Math.pow(k,3))) {
                System.out.println(n);
            }
            n++;
        }
    }
}
